<html>
    <head>
        <title>todolist</title>
    </head>
    <body>
        <div id="app">
            <input type="text" name="" id="cont1" v-model="content">
            <input type="button" value="增加事项" v-on:click="addItem">
            <div id="test_show" style="background-color: gray;width:600px;height:400px;">
                <p v-for="(value,index) in itemList" :key="index">{{value.content}}</p>
            </div>
            
        </div>
        <script src="./vue.js"></script>
        <script>
            let vm = new Vue({
                el:"#app",
                data:{
                    content:'',
                    itemList:[]
                },
                methods:{
                    addItem(){
                       let user_content = this.content;
                       let sub_item = {
                        id:"1",
                        content:user_content,
                        datetime:""
                       }
                       this.itemList.push(sub_item);
                       this.content=""
                    }
                }
            })
        </script>
    </body>
</html>